#include <stdio.h>

int main()
{
	int i = 0;
	int j = 0;
	int a;
	while (scanf_s("%d", &a) != EOF)
		for (i = 0; i < a; i++)
		{
			for (j = 0; j < a; j++)
				if (i == 0 || j == 0 || j == a - 1 || i == a - 1)
				{
					printf("* ");
				}
				else
				{
					printf("  ");
				}


			printf("\n");
		}








	return 0;
}
